package cn.itcast.service.impl;

import cn.itcast.dao.IncomeDao;
import cn.itcast.service.IncomeService;
import com.alibaba.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.ArrayList;
import java.util.List;

@Service
public class IncomeServiceImpl implements IncomeService {

    @Autowired
    private IncomeDao incomeDao;

    //根据月份统计会员数量
    public List<Integer> findIncomeMoney(List<String> list) {
        List<Integer> IncomeMoney = new ArrayList<>();
        //遍历月份
        for (String month : list) {
            String minTime = month + ".01"; //一个月最小
            String maxTime = month + ".31";//一个月最大
            Integer money = incomeDao.findIncomeMoney(maxTime, minTime);
            IncomeMoney.add(money);
        }
        return IncomeMoney;
    }
}
